package com.netposa.controller;

import com.github.pagehelper.PageInfo;
import com.netposa.appwebres.WebResCallback;
import com.netposa.appwebres.common.WebResCriteria;
import com.netposa.appwebres.common.WebResInfo;
import com.netposa.condition.PoliceCondition;
import com.netposa.service.PoliceService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"/police"})
public class PoliceController {
   private static Logger logger = Logger.getLogger(PoliceController.class);
   @Autowired
   private PoliceService policeService;

   @PostMapping({"/getInfo"})
   public WebResInfo getInfo(final PoliceCondition condition) {
      return (new WebResCallback() {
         public void execute(WebResCriteria criteria, Object... params) {
            PageInfo pageInfo = PoliceController.this.policeService.getPoliceInfo(condition);
            criteria.addSingleResult(pageInfo);
         }
      }).sendRequest(new Object[0]);
   }
}
